<%@page import="org.eclipse.jdt.internal.compiler.ast.ForeachStatement"%>
<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@ page import="qingke.dao.Dao" %>
<%@ page import="qingke.pojo.Author" %>
<%@ page import="qingke.pojo.Article" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%  Dao d = new Dao();
    Author author = (Author)request.getSession().getAttribute("loginuser");
    List<Article> articles = d.getAllArticle();
/*     List<String> titles = new ArrayList();
    titles.add("1");
    titles.add("2");
    titles.add("3");
    titles.add("4"); */
	%>
<div style="height:200px;width:600px">
<h3>文章列表</h3>

<% for(Article article : articles){
	out.println("<lable>"+article.getTitle()+"</lable>");
	out.println("作者:"+"<lable>"+article.getAuthor().getUsername()+","+"</lable>");
	}
%>
</div>

<form action="/blog/Read">
<p>请输入文章标题</p>
<input name="title"><br/>
<p>请输入作者</p>
<input  name="author"><br/>
<input type="submit" value="阅读">
</form>
<div style="height:1000px;width:800px;overflow:scroll;">
<%out.println("<p>"+request.getSession().getAttribute("content")+"</p>"); %>
</div>
<form action="/blog/Like">
<label>如果喜欢，可以点赞</label>
<input type="submit" value="赞">
</form>
<div>
<%if("1".equals(request.getSession().getAttribute("islike"))){
	out.println("<lable>"+"您对这篇文章已经点过赞，请勿重复点赞"+"</lable>");
	}else if("1".equals(request.getSession().getAttribute("like"))){
		out.println("<lable>"+"点赞成功，谢谢"+"</lable>");
	}
    request.getSession().setAttribute("islike", "0");
    request.getSession().setAttribute("like", "0");
	%>
</div>

</body>
</html>